﻿//-----------------------------------------------------------------------
// <copyright file="SendPrivateMessageWindow.xaml.cs" company="AFS">
// Copyright (c) AFS. All rights reserved.
//
//    This file is part of Chatbox.
//
//    Chatbox is free software: you can redistribute it and/or modify
//    it under the terms of the GNU Lesser General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    any later version.
//
//    Chatbox is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//    GNU Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public License
//    along with Chatbox. If not, see http://www.gnu.org/copyleft/lesser.html
// </copyright>
//----------------------------------------------------------------------- 

namespace ChatBox.UI.Windows.SendPrivateMessage
{
    using System.Windows;
    using System.Windows.Input;

    /// <summary>
    /// Window to capture and send a private message
    /// </summary>
    public partial class SendPrivateMessageWindow : Window
    {
        /// <summary>
        /// Initializes a new instance of the SendPrivateMessageWindow class
        /// </summary>
        public SendPrivateMessageWindow()
        {
            InitializeComponent();

            this.messageText.Focus();
        }

        /// <summary>
        /// Key down event handler
        /// </summary>
        /// <param name="sender">the event sender</param>
        /// <param name="e">the event params</param>
        private void MessageTextKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                this.sendButton.Command.Execute(this.DataContext);
            }
        }
    }
}
